package cn.codehaus.core.system.dao.user;

import java.util.List;
import org.springframework.stereotype.Repository;

import cn.codehaus.core.common.dao.impl.BaseHibernateDaoImpl;

@Repository("userDao")
public class UserDaoImpl extends BaseHibernateDaoImpl<SysUsers> implements
		UserDao {

	
	public UserDaoImpl() {
		setOrderPropertyName(USER_ID);
	}

	public List<SysUsers> findByPassword(String password) {
		return super.findByProperty(PASSWORD, password);
	}

	public List<SysUsers> findByUserName(String userName,
			final int firstResult, final int size) {
		return super.findByProperty(USERNAME, userName, firstResult, size);
	}

	@Override
	public List<SysUsers> findByAccounts(String accounts) {
		System.out.println(accounts + "rrrrrrrr");
		return super.findByProperty(ACCOUNTS, accounts);
	}

	@Override
	public List<SysUsers> findByAccountsAndPassword(String accounts,
			String password) {
		String[] propertyNames = new String[] { ACCOUNTS, PASSWORD };
		String[] values = new String[] { accounts, password };
		return findByProperty(propertyNames, values);
	}

}
